使用kettle进行数据统计

您所在的位置:网站首页 kettle 设置变量 使用kettle进行数据统计

使用kettle进行数据统计

2023-06-01 14:31| 来源: 网络整理| 查看: 265

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {

  if (first) {

    first = false;

    /* TODO: Your code here. (Using info fields)

    FieldHelper infoField = get(Fields.Info, "info_field_name");

    RowSet infoStream = findInfoRowSet("info_stream_tag");

    Object[] infoRow = null;

    int infoRowCount = 0;

    // Read all rows from info step before calling getRow() method, which returns first row from any

    // input rowset. As rowMeta for info and input steps varies getRow() can lead to errors.

    while((infoRow = getRowFrom(infoStream)) != null){

      // do something with info data

      infoRowCount++;

    }

    */

  }

  Object[] r = getRow();

  if (r == null) {

    setOutputDone();

    return false;

  }

  // It is always safest to call createOutputRow() to ensure that your output row's Object[] is large

  // enough to handle any new fields you are creating in this step.

  r = createOutputRow(r, data.outputRowMeta.size());

  /* TODO: Your code here. (See Sample)

  // Get the value from an input field

  String foobar = get(Fields.In, "a_fieldname").getString(r);

  foobar += "bar";

   

  // Set a value in a new output field

  get(Fields.Out, "output_fieldname").setValue(r, foobar);

  */

  // Send the row on to the next step.

  boolean ans = false;

  double mean = Double.parseDouble(get(Fields.In, "x(mean)").getString(r));

  double std = Double.parseDouble(get(Fields.In, "x(stdDev)").getString(r));

  double x = Double.parseDouble(get(Fields.In, "x").getString(r));

  if(x>=(mean-std) && x



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3